ADD_DEFINITIONS(-DBMPLUGIN_LIBRARY)


SET(LIB_NAME bmPlugin)

SET(HEADER_PATH ${BLUEMOON_SOURCE_DIR}/include/${LIB_NAME})
SET(SOURCE_PATH ${BLUEMOON_SOURCE_DIR}/src/${LIB_NAME})

SET(QT_MOC_SOURCES_H
    ${HEADER_PATH}/PluginMainWindow.h
)
IF(Qt5Widgets_FOUND)
  SET(CMAKE_AUTOMOC ON)
  #SET(CMAKE_INCLUDE_CURRENT_DIR ON)
  QT5_WRAP_UI( LIB_UI_HDRS ${LIB_QT_UIS} )
  IF(Qt5Widgets_VERSION VERSION_LESS 5.2.0)
      QT5_WRAP_CPP( LIB_UI_SRCS ${LIB_UI_HDRS} OPTIONS "-f" )
      QT5_WRAP_CPP( LIB_MOC_SRCS ${QT_MOC_SOURCES_H} OPTIONS "-f" )
  ELSE()
      QT5_WRAP_CPP( LIB_UI_SRCS ${LIB_UI_HDRS} )
      QT5_WRAP_CPP( LIB_MOC_SRCS ${QT_MOC_SOURCES_H} )
  ENDIF()
  SET(${SOURCES_CXX_MOC}
    ${LIB_UI_SRCS}
    ${LIB_MOC_SRCS}
    )
ELSE()
  QT4_WRAP_CPP( SOURCES_CXX_MOC ${QT_MOC_SOURCES_H} OPTIONS "-f" )
ENDIF()

SOURCE_GROUP(${QTMocFileGroupName} FILES ${SOURCES_CXX_MOC})



SET(LIB_PUBLIC_HEADERS
  ${HEADER_PATH}/export.h
  ${HEADER_PATH}/bmPlugin.h
  #  ${HEADER_PATH}/PluginMainWindow.h
)

SET( LIB_SOURCES
  ${QT_MOC_SOURCES_H}
  ${SOURCES_CXX_MOD}
  ${LIB_UI_HDRS}
  ${SOURCE_PATH}/CMakeLists.txt
  ${SOURCE_PATH}/bmPlugin.cpp
  ${SOURCE_PATH}/PluginMainWindow.cpp
)

#SET(LIB_INTERNALS
#  DataDB
#  Net
#  )

SET(LIB_DEPS
  #TINYXML_LIBRARY
  OPENTHREADS_LIBRARY
  OSGTEXT_LIBRARY
  )

IF(QT4_FOUND)
  INCLUDE_DIRECTORIES(
    ${QT_INCLUDE_DIR}
    ${QT_QTCORE_INCLUDE_DIR}
    ${QT_QTGUI_INCLUDE_DIR}
    ${QT_QTOPENGL_INCLUDE_DIR}
    )
  SET(LIB_DEPS
    ${LIB_DEPS}
    QT_QTCORE_LIBRARY
    QT_QTGUI_LIBRARY
    QT_QTOPENGL_LIBRARY
    )
ENDIF(QT4_FOUND)

BLUEMOON_ADD_LIBRARY(${LIB_NAME})

IF(Qt5Widgets_FOUND)
    qt5_use_modules(${LIB_NAME} Widgets OpenGL )
ENDIF(Qt5Widgets_FOUND)
